import httpRequest from '@/config/axios/httpRequest'
import {
  BpmFormCreateReq,
  BpmFormCreateResp,
  BpmFormDeleteReq,
  BpmFormDeleteResp,
  BpmFormGetReq,
  BpmFormGetResp,
  BpmFormListReq,
  BpmFormListResp,
  BpmFormPageReq,
  BpmFormPageResp,
  BpmFormUpdateReq,
  BpmFormUpdateResp
} from '@/models/bpm/BpmFormModel'
import bpmapi from '../bpmapi'

// 创建工作流的表单定义
export const createForm = async (data: BpmFormCreateReq) => {
  return await httpRequest.post<BpmFormCreateResp>(bpmapi.BpmFormCreate, data)
}

// 更新工作流的表单定义
export const updateForm = async (data: BpmFormUpdateReq) => {
  return await httpRequest.put<BpmFormUpdateResp>(bpmapi.BpmFormUpdate, data)
}

// 删除工作流的表单定义
export const deleteForm = async (data: BpmFormDeleteReq) => {
  return await httpRequest.delete<BpmFormDeleteResp>(bpmapi.BpmFormDelete, { data })
}

// 获得工作流的表单定义
export const getForm = async (params: BpmFormGetReq) => {
  return await httpRequest.get<BpmFormGetResp>(bpmapi.BpmFormGet, { params })
}

// 获得工作流的表单定义分页
export const getFormPage = async (params: BpmFormPageReq) => {
  return httpRequest.get<BpmFormPageResp>(bpmapi.BpmFormPage, { params })
}

// 获得动态表单的精简列表
export const getFormSimpleList = async (params: BpmFormListReq) => {
  return await httpRequest.get<BpmFormListResp>(bpmapi.BpmFormList, { params })
}
